package pcb.control.commands 
{
	import com.intel.patterns.cairngorm.CairngormEvent;
	import com.intel.utils.Debugger;
	import flash.net.SharedObject;
	import flash.system.Capabilities;
	import pcb.control.delegates.Del_loadLesson;
	import pcb.control.events.LoadDataEvent;
	import pcb.control.responders.Re_processorChk;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class Cmd_processorChk extends AbstractCommand 
	{
		
		public function Cmd_processorChk() 
		{
			trace("dave");
		}
		
		override public function execute(event:CairngormEvent):void 
		{
			Debugger.traceOut("Cmd_processorChk > execute()");
			
			var eulaSo:SharedObject = SharedObject.getLocal("intelEulaInfo");
			
			//check if user has already agreed to eula in previous session
			if (eulaSo.data.agreed != "yes") {
				
				var platform:String = Capabilities.version.split(" ")[0];
				var path:String;
				path = (models.playerSettings.deployment != "web")? "C:\\User\\PCB\\":"";
				
				Debugger.traceOut("Platform " + platform);
				
				var del:Del_loadLesson = new Del_loadLesson(new Re_processorChk());
				
				del.load(path+"ver.txt");
				
			}else {//user has already agreed to eula
				
				var ev:LoadDataEvent = new LoadDataEvent(LoadDataEvent.RETRIEVE_LESSON_ID);
				ev.dispatch();
					
				if(models.playerSettings.useMainMenu) if(!models.playerStateModel.activated){
					var evMenu:LoadDataEvent = new LoadDataEvent(LoadDataEvent.LOAD_MAIN_MENU);
					evMenu.dispatch();
				}
					
				models.playerStateModel.activated = true;
			}
			
		}
		
	}
	
}